﻿using Playnite.SDK.Models;
using Playnite.SDK.Plugins;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ImportExporter
{
    public class FakeGame
    {
        public Guid Id { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public string Notes { get; set; }
        public ReleaseDate? ReleaseDate { get; set; }
        public List<Link> Links { get; set; }
        public int? CommunityScore { get; set; }
        public string BackgroundImage { get; set; }
        public string Icon { get; set; }
        public string CoverImage { get; set; }
        public List<string> Genres { get; set; }
        public List<string> Developers { get; set; }
        public List<string> Features { get; set; }
        public List<string> Publishers { get; set; }
        public List<string> Series { get; set; }
        public List<string> Categories { get; set; }
        public string Library { get; set; }
        public List<string> Platforms { get; set; }
        public List<string> AgeRatings { get; set; }
        public List<string> Regions { get; set; }
        public List<string> Tags { get; set; }
        //public Game OriginalGame { get; set; }
        public FakeGame(Game aGame)
        {
            this.Id = aGame.Id;
            this.Name = aGame.Name;
            this.Description = aGame.Description;
            this.Notes = aGame.Notes;
            this.ReleaseDate = aGame.ReleaseDate;
            this.Links = aGame.Links.ToList<Link>();
            this.CommunityScore = aGame.CommunityScore;
            this.BackgroundImage = aGame.BackgroundImage;
            this.Icon = aGame.Icon;
            this.CoverImage = aGame.CoverImage;
            this.Genres = aGame.Genres?.Select((Genre a) => a.Name).ToList<string>();
            this.Developers = aGame.Developers?.Select((Company a) => a.Name).ToList<string>();
            this.Features = aGame.Features?.Select((GameFeature a) => a.Name).ToList<string>();
            this.Publishers = aGame.Publishers?.Select((Company a) => a.Name).ToList<string>();
            this.Series = aGame.Series?.Select((Series a) => a.Name).ToList<string>();
            this.Categories = aGame.Categories?.Select((Category a) => a.Name).ToList<string>();
            this.Platforms = aGame.Platforms?.Select((Platform a) => a.Name).ToList<string>();
            this.AgeRatings = aGame.AgeRatings?.Select((AgeRating a) => a.Name).ToList<string>();
            this.Regions = aGame.Regions?.Select((Region a) => a.Name).ToList<string>();
            this.Tags = aGame.Tags?.Select((Tag a) => a.Name).ToList<string>();
            if ((aGame.PluginId == null) || (aGame.PluginId == Guid.Empty))
            {
                this.Library = "Playnite";
            }
            else
            {
                if (LibraryList.ContainsKey(aGame.PluginId))
                {
                    this.Library = LibraryList[aGame.PluginId];
                }
                else
                {
                    this.Library = "Unknown";
                }
            }
        }

        public static Dictionary<Guid, string> LibraryList { get; } = new Dictionary<Guid, string>
        {
            { Guid.Parse("E3C26A3D-D695-4CB7-A769-5FF7612C7EDD"), "Battle.net" },
            { Guid.Parse("0E2E793E-E0DD-4447-835C-C44A1FD506EC"), "Bethesda" },
            { Guid.Parse("00000002-DBD1-46C6-B5D0-B1BA559D10E4"), "Epic" },
            { Guid.Parse("AEBE8B7C-6DC3-4A66-AF31-E7375C6B5E9E"), "Gog" },
            { Guid.Parse("00000001-EBB2-4EEC-ABCB-7C89937A42BB"), "Itch.io" },
            { Guid.Parse("85DD7072-2F20-4E76-A007-41035E390724"), "Origin" },
            { Guid.Parse("CB91DFC9-B977-43BF-8E70-55F46E410FAB"), "Steam" },
            { Guid.Parse("E2A7D494-C138-489D-BB3F-1D786BEEB675"), "Twitch" },
            { Guid.Parse("C2F038E5-8B92-4877-91F1-DA9094155FC5"), "Ubisoft Connect" },
            { Guid.Parse("96e8c4bc-ec5c-4c8b-87e7-18ee5a690626"), "Humble"},
            { Guid.Parse("7e4fbb5e-2ae3-48d4-8ba0-6b30e7a4e287"), "Xbox" },
            { Guid.Parse("402674cd-4af6-4886-b6ec-0e695bfa0688"), "Amazon Games" },
            { Guid.Parse("e4ac81cb-1b1a-4ec9-8639-9a9633989a71"), "PlayStation" },
            { Guid.Parse("f7da6eb0-17d7-497c-92fd-347050914954"), "Indiegala" },                                //by lacro59
            { Guid.Parse("77346DD6-B0CC-4F7D-80F0-C1D138CCAE58"), "Occulus" },                                  //by Jesibu & Ransel
            { Guid.Parse("88409022-088a-4de8-805a-fdbac291f00a"), "Rockstar" },                                 //by crow
            { Guid.Parse("2366fb38-bf25-45ea-9a78-dcc797ee83c3"), "Importer for AniList" },                     //by darklinkpower
            { Guid.Parse("5befaf7a-a0af-4ce2-992c-bc048d94e71b"), "XCloud" },                                   //by joyrider3774
            { Guid.Parse("e4ac81cb-1b1a-4ec9-8639-9a9633989a72"), "Nintendo" },                                 //by Xenor
            { Guid.Parse("d0217e44-0df5-45f7-8515-478bdf21a883"), "Battlestate Games (Escape from Tarkov)" },   //by Aliaksandr Dzik (DrinkFromTheCup)
            { Guid.Parse("317a5e2e-eac1-48bc-adb3-fb9e321afd3f"), "Riot Launcher" },                            //by Aliaksandr Dzik (DrinkFromTheCup)
            { Guid.Parse("3bf61d13-9730-442a-b9c0-f7228c8cd529"), "Space Station 13 (BYOND)" },                 //by Aliaksandr Dzik (DrinkFromTheCup)
            { Guid.Parse("ef6a8a8d-7d89-4a26-be54-a6584e33b478"), "Last Epoch" },                               //by Aliaksandr Dzik (DrinkFromTheCup)
            { Guid.Parse("a21f1ec0-9a7f-4adb-b8a5-78587ecb5394"), "Path of Exile" },                            //by Aliaksandr Dzik (DrinkFromTheCup)
            { Guid.Parse("5a25b200-7283-40a2-ad36-51abf4eb7ca0"), "Paradox" },                                  //by Aliaksandr Dzik (DrinkFromTheCup)
            { Guid.Parse("ef17cc27-95d4-45e7-bd49-214ba2e5f4b2"), "Fanatical" },                                //by NosyN00b
            { Guid.Parse("6ab2531e-4800-404b-a938-4421b28a9f3e"), "MultiMC" },                                  //by Maxine
            { Guid.Parse("62ac4052-e08a-4a1a-b70a-c2c0c3673bb9"), "Humble Keys Library" },                      //by Fierce Punch Studios
            { Guid.Parse("41e49490-0583-4148-94d2-940c7c74f1d9"), "EmuLibrary" },                               //by Nicholas Hastings (psychonic)
            { Guid.Parse("34c3178f-6e1d-4e27-8885-99d4f031b168"), "Legacy Games" },                             //by Jesibu
            { Guid.Parse("5f2dfd12-5f13-46fe-bcdd-64eb53ace26a"), "NVIDIA GeForce NOW" },                       //by darklinkpower
            { Guid.Parse("d407a620-5953-4ca4-a25c-8194c8559381"), "JAST USA" },                                 //by darklinkpower
            { Guid.Parse("42ff71aa-34dc-4b12-86b6-1328136c958f"), "Groupees" }                                  //by Jesibu
        };
    }
}
